The invention relates to managing data in a shared memory, which memory is the main memory of a computer in which a plurality of processes are executed simultaneously. Each process is itself generally made up of a plurality of elementary tasks which can be in competition to access data so as to read it or to modify it. Such a management method is implemented by software referred to as a "data manager". A computer includes a main memory which has limited capacity but in which all of the locations are accessible directly, and therefore very quickly, and a mass memory generally constituted by a hard disk having much larger capacity but offering much slower access because it is necessary to select a track, and then to wait for the desired location on a track to come to a position facing a read head. Conventionally, the operating system of the computer loads only that data which is actually necessary at a given instant into the main memory, and loading is performed via a specialized and fast small memory which is referred to as a cache memory, and which gives the impression of accelerating access to the hard disk, by means of an anticipation mechanism which uses the fact that data is generally used sequentially by applications. Conventional data managers have thus been optimized by taking into account that the data passes through a cache memory.
Progress made in semiconductor memory technology now makes it possible to provide a main memory having sufficient capacity to receive all of the data shared by all of the processes executed in a computer, even for applications handling large volumes of data. The hard disk then serves merely to back up the data by keeping an updated replica of all of the data in the main memory. Loading all of the data in the main memory is particularly advantageous for applications which do not use the data sequentially, a cache memory bringing only a small amount of benefit to such applications. This applies particularly to applications controlling telecommunications exchanges. It is therefore necessary to design data managers that are optimized to manage data entirely loaded in a main memory.
Data managers used in object-oriented data bases are known, as are data managers used in relational data bases.
There are two types of access to data: read access and write access. For each type of access, two transfer modes are known for transferring information between the data manager and an elementary task: a transfer mode by value and a transfer mode by pointer.
For read accessing or write accessing the value of a variable, the transfer mode by value consists in reading or writing a value of the variable in the memory location that contains the current value of the variable; whereas the transfer mode by pointer consists in supplying an address, referred to as a "pointer" to the task that requested the reading or writing, the pointer designating the memory location in which the value to be read is situated or the memory location in which a value is to be written, the task then being free to read or to write in this location so long as it possesses the pointer. When a task accesses a variable in the mode by pointer, it is known that a lock referred to as a "hold" can be allocated to the memory location that contains the current value of said variable, for said task, so as to maintain the consistency of the data seen by each task. The hold is an exclusive right of access to the current value of said variable, so long as the hold is not released.
Transfer mode by pointer is known in object-oriented data managers. It offers the advantage of making fast access possible. It enables data to be handled as a variable of a programming language. But object data managers suffer from the drawback either of not offering multi-task transactions (there is therefore no competition), or of not offering locking at an object (any competition results in a page being locked and causes the page to be copied in full into a log. This level of granularity thus gives rise to increased cost).
The transfer mode by value can be used without managing access competition. Access competition is managed by a "transactional" protocol which is applied by the data manager of the base.
A set of read operations and/or of write operations relating to a plurality of variables and requested by a task in the same request is referred to as a "transaction". In a transaction, each operation may be performed either with the transfer mode by value or with the transfer mode by pointer. Any transaction can be broken down into three stages:
An opening stage during which the data manager supplies a single transaction identifier to the task that has opened the transaction, which identifier designates a memory location containing a descriptor of the transaction. PA1 An access stage during which the read operations or the write operations are executed by the task that has opened the transaction, but remain invisible for users other than this transaction; and during which rights called read locks and write locks are allocated to the transaction, for the memory location in question. In one known access method, when a transaction performs write access, it temporarily enters the new value of the variable in a memory location referred to as a "log" and allocated to the transaction for said variable. This log can be accessed only by said transaction. PA1 A closing or validation stage during which the writing and reading is validated. In the above-mentioned known method, the new values (which are contained in the logs allocated to the transaction) are entered in the locations containing the respective current values, and they become visible to all of the tasks. The values to be read are actually read. PA1 A read lock allocated to a given transaction for a given memory location is a non-exclusive right allocated to the transaction, authorizing said transaction to read the value stored in the memory location and preventing any other transaction that wishes to write in the memory location from being validated. PA1 A write lock allocated to a given transaction for a given memory location is an exclusive write allocated to the transaction, authorizing said transaction and only said transaction to write a value in the memory location. PA1 If it is abortable, it is released when a transaction that is competing with the transaction possessing the abortable lock has priority thereover. The transaction possessing the lock is then aborted. PA1 If it is non-abortable, it is not released when a transaction that is competing with the transaction possessing the abortable lock has priority thereover. The transaction possessing the lock is not aborted. PA1 atomicity (all of the accesses requested by a transaction are processed or none of them are); PA1 consistency (all of the data goes from one stable state to another stable state); PA1 isolation (the new values of the variable are not visible outside the transaction, before the transaction is closed); PA1 durability (as soon as a transaction is validated, the new values of the variables withstand failure of the station on which they are stored, since said new values are backed up on a disk or on another station in working order); and PA1 serialization (if a plurality of transactions take place in parallel, their results are the same as if they were to take place successively). PA1 for each variable to be read, a read operation consists in: allocating a lock referred to as a "hold" to the variable to be read, which hold prevents any access to said variable, if there is not already a hold allocated to said variable; or in allocating a new hold to said variable, after waiting for the preceding hold to be released, if a preceding hold was allocated to said variable; and consists either in supplying a pointer designating a memory zone containing the current value of said variable to the process that requested said read operation; or else in supplying the current value of the variable and in copying it in atomic manner into a memory location that belongs to the task that requested said read operation; and then in releasing the hold; and PA1 for each variable to be written, a write operation consists in the following steps: PA1 consists either in supplying a pointer designating a memory zone containing the current value of the variable to the task that requested said read operation; or else in supplying a new value for each variable to write, then in copying the new value into said log, then in releasing the non-abortable write lock, and finally in releasing said hold; and PA1 for each variable to be read, a read operation consists in performing the following steps: PA1 consists either in supplying a pointer for each variable to be read to the task that requested said read operation, which pointer designates the log containing the value of the variable; or in supplying the value of the variable and in copying it in atomic manner into a memory zone that belongs to a process that requested said read operation; and then releasing the hold; PA1 consists either in supplying a pointer for the variable to be read to the task that requested said read operation, which pointer designates a memory zone containing the value of said variable; or in supplying a value read from the log and in copying it in atomic manner into a memory zone that belongs to a process that requested the read operation; and then in releasing the hold; PA1 for each variable to write, a write operation consists in the following steps: PA1 consists either in supplying a pointer for each variable to be written, which pointer designates the log, or in copying the new value into the log, and then in releasing the hold; PA1 consists then either in supplying a pointer designating the log; or in supplying a new value for each variable to be written, and in copying the new value into the log, then in releasing the hold.
A lock can be allocated to the memory location containing the current value or the new value of a variable so as to prevent other operations which might jeopardize the consistency of the data. A lock can be allocated to an entire table of data. There are two types of lock:
In certain systems, priority may be allocated to a variable to give priority to one type of operation (reading or writing) over the other type, when two transactions are competing to perform two different operations on the variable. The transaction that requests the higher-priority operation is said to be the "priority" transaction for said variable.
A read lock or a write lock can be either abortable or non-abortable:
An abortable lock goes to the non-abortable state when that transaction that possesses it is validated. Simultaneously, the abortable locks of the competing transactions are released, and the competing transactions are aborted.
Certain transactional protocols make it possible to perform a transaction while guaranteeing four properties referred to as "ACID":
Patent Application FR 2 727 222 describes such a transactional protocol. Known data managers guarantee the "ACID" properties but they suffer from the drawback of not offering access by pointer. The prior art thus offers no method that is entirely satisfactory.